//
//  ViewController.m
//  delegateTest2
//
//  Created by 谷士雄 on 16/7/18.
//  Copyright © 2016年 alan. All rights reserved.
//

//  secondVc传值给Vc,所以应该是Vc作为secondVc的代理，在代理方法接收secondVc传过来的值

#import "ViewController.h"
#import "ATNextViewController.h"

@interface ViewController () <GSYVcDelegate>
@property (nonatomic, weak) UIButton *btn;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
    btn.backgroundColor = [UIColor greenColor];
    [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
    self.btn = btn;

}

// 点击按钮跳转到第二个界面
- (void)btnClick:(UIButton *)btn {
    ATNextViewController *nextVc = [[ATNextViewController alloc] init];
    nextVc.delegate = self;
    [self.navigationController pushViewController:nextVc animated:YES];
}

#pragma mark - ATNextVcDelegate

-(void)gsyStr:(NSString *)gsyStr {
    NSLog(@"接受传递过来的值：%@",gsyStr);
}

@end
